home *** CD-ROM | disk | FTP | other *** search
/ Softwarová Záchrana 3 / Softwarova-zachrana-3.bin / Xteq X-Setup / xqdcXSP-Setup-EN.exe / {app} / plugins / XQ IE Clear Cache.xpl < prev    next >
Text File  |  2004-04-28  |  5KB  |  155 lines

  1. "FILE"="Xteq Systems X-Setup Plugin 5.0"
  2. "TYPE"="5"
  3. "COUNT"="2"
  4. "UIPATH"="Internet\Internet Explorer\Clear"
  5. "NAME"="Clear Cache"
  6. "VERSION"="2.15"
  7. "OSVERSION"="00010111"
  8. "LANGUAGE"="VBScript"
  9. "TEXT 1"="Clear IE Cache"
  10. "TEXT 2"="Clear IE Cache (Security Wipe)"
  11. "DESCRIPTION 1"="This plug-in will totally erase the entire contents of the IE Cache."
  12. "DESCRIPTION 2"="If you select to open the second option, every file found (except INDEX.DAT) will be filled with garbage before deleting so even an undelete does not show what was inside the files."
  13. "DESCRIPTION 3"="IMPORTANT! Close Internet Explorer before using any of these functions!"
  14. "AUTHOR"="Xteq Systems"
  15. "CONTACTURL"="http://www.xteq.com"
  16. "COPYRIGHT"="Copyright ⌐ Xteq Systems - All Rights Reserved"
  17. "COMMENT 1"="Thanks to CptSiskoX for the help."
  18. "COMMENT 2"="Thanks to William Baugh of buttuglysoftware.com for his help"
  19.  
  20. sP="HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Cache"
  21.  
  22. sPFRO="HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations"
  23. sPFRO_Txt="\??\"
  24.  
  25. sMsg_NotYet="We are sorry, but the PendingFileRenameOperations registry value can not be used for clearing since this value is already existing. Please restart your computer so these pending operations can be executed and start this plug-in again after that."
  26. sMsg_Done="The cache has been cleared."
  27. sMsg_Done2=" However, some file are in use by Windows so they can not be deleted right now. These files has been marked for deletion which will take place the next time this computer is restarted. Therefore, you should restart your computer as soon as possible."
  28.  
  29.  
  30. Sub Plugin_Initialize 
  31. End Sub
  32.  
  33. Sub Plugin_CheckData(ElementIndex)
  34. End Sub
  35.  
  36. Sub Plugin_Apply(ElementIndex,ElementSubIndex)
  37. ' If RegValueExists(sPFRO) then
  38. '    Call MsgError(sMsg_NotYet)
  39. ' else
  40.     if ElementIndex=1 then 
  41.        Call DoWork(false)  
  42.     else
  43.        Call DoWork(true)
  44.     end if
  45. ' end if
  46. End Sub
  47.  
  48. Sub DoWork(EraseTotally)
  49.     s=RegReadValue(sP)
  50.     
  51.     if folderexists(s) then
  52.        i=FolderEnum(s)
  53.        if i>0 then
  54.           sBasePath=FolderEnumElement(1)
  55.           iCount=FolderEnum(sBasePath)
  56.  
  57.           for i=1 to iCount
  58.               Call KillDir(FolderEnumElement(i),EraseTotally,true)
  59.           next
  60.                    
  61.           'okay, now look for any remaing files...
  62.           Call KillDir(sBasePath,EraseTotally,false)
  63.  
  64.           bIndexDatQ=false
  65.  
  66.           if FileExists(sBasePath & "index.dat") then
  67.              bIndexDatQ=true
  68.              
  69.              'array
  70.              Dim aryLoc()
  71.              'resize it to two value
  72.              ReDim aryLoc(1)
  73.              i=0
  74.  
  75.              'Check if PFRO exists
  76.              If RegValueExists(sPFRO) then
  77.                 v=RegReadValue(sPFRO)
  78.                 
  79.                 'Resize our own array
  80.                 ReDim aryLoc(ubound(v)+2)
  81.                 '''msginformation ubound(v)  
  82.  
  83.                 for i=lbound(v) to ubound(v)
  84.                     aryLoc(i)=v(i)
  85.                 next 
  86.  
  87.                 ''''MsgInformation i
  88.              end if
  89.  
  90.  
  91.              aryLoc(i)=sPFRO_Txt & sBasePath & "index.dat"
  92.              aryLoc(i+1)=""
  93.              'Now write it 
  94.              Call RegWriteValue(sPFRO,aryLoc,5)
  95.           end if
  96.  
  97.  
  98.           'done!
  99.           sMsg=sMsg_Done
  100.           if bIndexDatQ=true then
  101.              sMsg=sMsg & sMsg_Done2
  102.           end if
  103.  
  104.           msginformation sMsg
  105.        end if
  106.     else
  107.        msgerror "Unable to locate IE Cache - nothing done!"
  108.     end if
  109. end Sub
  110.  
  111.  
  112. Sub KillDir(DirName,EraseTotally,KillDirAlso)
  113.  iC=FileEnum(DirName & "*.*")
  114.  
  115.  for i=1 to iC 
  116.      sFile=FileEnumElement(i)
  117.      'index.dat can not be earased, always locked for writing... grr..
  118.      if lcase(right(sFile,9))<>"index.dat" then
  119.    
  120.         if EraseTotally then
  121.            lC=TxtOpen(sFile)
  122.  
  123.            'replace contents of file    
  124.            for l=1 to lC 
  125.                Call TxtSetLine(l,"-")
  126.            next
  127.          
  128.            'desktop.ini is special case..
  129.            if right(sFile,11)="desktop.ini" then
  130.               Call FileSetAttribute(sFile,"R-")
  131.               Call FileSetAttribute(sFile,"H-")
  132.               Call FileSetAttribute(sFile,"S-")
  133.            end if
  134.  
  135.           Call TxtSave()
  136.         end if
  137.  
  138.         Call FileSetAttribute(sFile,"R-")
  139.  
  140.         'now kill the file
  141.         FileDelete(sFile)
  142.      end if               
  143.  
  144.  next 
  145.  
  146.  if KillDirAlso=true then
  147.     FolderDelete(DirName)
  148.  end if
  149. End Sub
  150.  
  151.  
  152. Sub Plugin_Terminate 
  153. End Sub
  154.  
  155.